<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
Ext.onReady(function() {
	
	Ext.QuickTips.init();
	
	var top=Ext.widget({
		 xtype: 'form',
	        layout: 'form',
	        renderTo:'addreturnvisit',
	        frame:true,
	        fieldDefaults: {
	            msgTarget: 'qtip',
	            labelWidth: 80
	        },
	        defaultType: 'textfield',
	        items: [{
	        	id:'reserveTime',
	            fieldLabel: '预约时间',
	            xtype: 'datefield',
	            format: 'Y-m-d',
	        	disabled: true
	        },{
	        	id: 'secuitName',
	        	fieldLabel: '学生姓名',
	        	disabled: true
	        },{
	        	id: 'userName',
	        	fieldLabel: '老师姓名',
	        	disabled: true
	        },{
	        	xtype: 'datefield',
	        	format: 'Y-m-d',
	        	fieldLabel: '回访时间',
	        	name: 'returnvisit.RVisitTime',
	        	id: 'RVisitTime'
	        },{
	        	xtype: 'textareafield',
	        	id: 'RVisitContent',
	        	name: 'returnvisit.RVisitContent',
	        	fieldLabel: '回访内容'
	        }],

        buttons: [{
            text: '保存',
            handler: function() {
       			this.up('form').getForm().submit({
                    url : '../service/returnvisit_add',//请求的url地址  
                    params: {id: Ext.getDom('reserveid').value},
                    method:'post',//请求方式
                    success:function(form,action){//加载成功的处理函数  
	                   	Ext.Msg.alert('提示', action.result.msg);
               		},
                    failure:function(form,action){//加载成功的处理函数  
  		        		Ext.Msg.alert('提示', action.result.msg); 
   		        	}
                });
        	}
        }],
        listeners:{
        	'render':function(){
        		Ext.Ajax.request({
        		    url: '../service/reserve_find',
        		    params: {
        		        id: Ext.getDom('reserveid').value
        		    },
        		    success: function(response, opts) {
        		        var obj = Ext.decode(response.responseText);
        		        Ext.getCmp('secuitName').setValue(obj.reservevo.secuitName);
        		        Ext.getCmp('userName').setValue(obj.reservevo.userName);
        		        var rtime=obj.reservevo.reserveTime.split('T')[0];
        		        Ext.getCmp('reserveTime').setValue(rtime);
        		    },
        		});
        	}
        }
    });
});
</script>
</head>
<body>
<input type="hidden" id="reserveid" value="<s:property value='id'/>"/>
<div id="addreturnvisit"></div>
</body>
</html>